home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 12690 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: nntp.teleport.com!usenet
  2. From: Scott Kinard <kinards@teleport.com>
  3. Newsgroups: comp.lang.c,comp.lang.perl
  4. Subject: Random File Access - I don't get it
  5. Date: Mon, 01 Apr 1996 23:58:22 -0800
  6. Organization: Teleport - Portland's Public Access (503) 220-1016
  7. Message-ID: <3160DE1E.495C@teleport.com>
  8. NNTP-Posting-Host: ip-vanc1-22.teleport.com
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 2.01 (Win16; I)
  13.  
  14. Greetings,
  15.  
  16.   As I was coding a simple program to randomly read lines from a text file it occurred 
  17. to me something was amiss. This is probably some fundamental oversight on my part, but 
  18. some illumination would be helpful...
  19.  
  20.   Suppose I have two files, one contains text (1 line of random length text per 
  21. 'record') and another which is my index into the text file, which contains the starting 
  22. and ending byte positions in the text file for each 'record'. Now the question..
  23.  
  24. Suppose the text file has 2,000,000 entries. Now, what's the difference in reading 
  25. 1,000,000 lines from the index file to find the starting and ending byte positions in 
  26. the text file for record 1,000,000, and then seeking these in the text file, rather than 
  27. just reading 1,000,000 times from the text file to get the same 'record' in the first 
  28. place?
  29.  
  30. -Scott
  31.